import http from "../request.js";
const header = { "Content-Type": "application/x-www-form-urlencoded" };
const jsonHeader = { "Content-Type": "application/json" };
// post 请求 使用 params get请求 使用 { params }
class GroupCenter {
	constructor() {
		// 拼团
	 this.getGoods_Api =           "/api/groups/index/getGoods";           // 首页拼团list
	 this.getLists_Api =           "/api/groups/goods/getLists";           // 更多拼团商品
	 this.getDetailGroup_Api =     "/api/groups/goods/getDetail";          // 拼团商品详情
	 
	 this.orderBuyApi =            "/api/groups/order/buyNow";             // 立即开团
	 this.buyNow_pay2Api =         "/api/groups/order/buyNow_pay2";        // 拼团提交订单
	 this.groups_payApi =          "/api/groups/order/groups_pay";         // 拼团余额支付
	 
	 this.progress_listApi =       "/api/groups/team/progress_list";       // 对应商品的团
	 this.getMyTeamsApi =          "/api/groups/team/getMyTeams";          // 我的拼团
	 this.getTeamDetailApi =       "/api/groups/team/getTeamDetail";       // 我的团详情
	} 
	getGoodsGroup(params) { // 首页拼团list
	  return http.post(this.getGoods_Api, params).then((res) => res.data);
	}
	getLists(params) { // 更多拼团商品
		return http.post(this.getLists_Api, params || {}).then((res) => res.data);
	}
	getDetailGroup(params) { // 拼团商品详情
		return http.post(this.getDetailGroup_Api, params|| {}).then((res) => res.data);
	}
	
	orderBuy(params) { // 立即开团
		return http.post(this.orderBuyApi, params|| {}).then((res) => res.data);
	}
	buyNow_pay2(params) { // 拼团提交订单
		return http.post(this.buyNow_pay2Api, params|| {}).then((res) => res.data);
	}
	groups_pay(params) { // 拼团余额支付
		return http.post(this.groups_payApi, params|| {}).then((res) => res.data);
	}
	
	progress_list(params) { // 对应商品的团
		return http.post(this.progress_listApi, params|| {}).then((res) => res.data);
	}
	getMyTeams(params) { // 我的拼团
		return http.post(this.getMyTeamsApi, params|| {}).then((res) => res.data);
	}
	getTeamDetail(params) { // 我的团详情
		return http.post(this.getTeamDetailApi, params|| {}).then((res) => res.data);
	}
	


}

export const GroupCenterApi = new GroupCenter();
		